***Replication materials for "The Collapse of State Power, the Cluniac Reform Movement, and the Origins of Urban Self-Government in Medieval Europe"***
*Set working directory to folder containing tscs_final.dta, cs_final.dta, and cs_alt_final.dta*
*require the following additional stata modules: ivreg2, xtoverid, and plausexog* 

**Main results**
**		      **
set matsize 5000
**Table 1**	
use tscs_final.dta, replace
reg council c.dist_cluniac_monastery##post ,  cluster(indicator) 
reg council dist_cluniac_x_post i.year, absorb(indicator) cluster(indicator)   
reg council dist_cluniac_x_post i.year bishop capital plundered realm_parliament lpop university, absorb(indicator) cluster(indicator)  
reg council dist_cluniac_x_post i.year c.year##bishop c.year##c.realm_parliament c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  


**Table 2**
use cs_final.dta, replace
reg pre_pop_growth dist_cluny  latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub, r
reg pre_become_episcopal_seat dist_cluny  latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub , r
reg pre_nr_attacks dist_cluny latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub, r

**Table 3**
ivreg2 council_1000_1800 latitude longitude sea river soilquality elevation ruggedness i.carolingian  roman_hub (dist_cluniac=dist_cluny), r first
ivreg2 council_1000_1800 pre_pop_growth pre_become_episcopal_seat bishop lpop pre_nr_attacks capital latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub (dist_cluniac=dist_cluny), r first
ivreg2 council_1000_1200 latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub (dist_cluniac=dist_cluny), r first
ivreg2 council_1201_1800 latitude longitude sea river soilquality elevation ruggedness i.carolingian roman_hub (dist_cluniac=dist_cluny), r first


**Online Appendix and Extra Results**
**			     **

**Table A0**
use tscs_final.dta, replace
sum bishop capital plundered lpop university realm_parliament

**Table A2**
reg council dist_cluniac_x_post i.year c.year#i.modern_country c.year##c.realm_parliament  c.year##bishop c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
reg council dist_cluniac_x_post i.year c.year#i.realm c.year##c.realm_parliament c.year##bishop c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
reg council dist_cluniac_x_post i.year c.year#i.indicator c.year##c.realm_parliament c.year##bishop c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
reg council dist_cluniac_x_post i.year c.year##c.pscore c.year##c.realm_parliament c.year##bishop c.year##capital c.year##c.plundered c.year##c.lpop c.year##university,cluster(indicator) absorb(indicator)

**Figure A3**
hist pscore if year==1000, xtitle("Propensity to adopt new institution")

**Results with non-Christian towns excluded, page 7 in Appendix**
reg council dist_cluniac_x_post i.year c.year##bishop c.year##c.realm_parliament c.year##capital c.year##c.plundered c.year##c.lpop c.year##university if muslim!=1, absorb(indicator) cluster(indicator)  

**Table A3**
use cs_alt_final.dta, replace
ivreg2 council_1000_1800 latitude longitude sea river elevation ruggedness soilquality roman i.carolingian (dist_cluniac=dist_cluny), r first
ivreg2 council_1000_1800 latitude longitude sea river elevation ruggedness soilquality roman i.carolingian lnpop bishop (dist_cluniac=dist_cluny), r first
ivreg2 council_1000_1200 latitude longitude sea river elevation ruggedness soilquality roman i.carolingian (dist_cluniac=dist_cluny), r first
ivreg2 council_1201_1800 latitude longitude sea river elevation ruggedness soilquality roman i.carolingian (dist_cluniac=dist_cluny), r first
*Results with councils that appear prior to 1150, footnote 86*
ivreg2 council_1000_1150 latitude longitude sea river elevation ruggedness soilquality roman i.carolingian (dist_cluniac=dist_cluny), r first

**Table A4**
use tscs_final.dta, replace
qui xtivreg council td2-td11 (dist_cluniac_x_post=dist_cluny_x_post),vce(clu indicator)  fe 
xtoverid, noi
qui xtivreg council td2-td11 bishop realm_parliament capital plundered lpop university (dist_cluniac_x_post=dist_cluny_x_post),vce(clu indicator) fe
xtoverid, noi
qui xtivreg council td2-td11 bishop realm_parliament capital plundered lpop university bishop_x_year capitol_x_year plundered_x_year lpop_x_year university_x_year realm_x_year (dist_cluniac_x_post=dist_cluny_x_post),vce(clu indicator) fe
xtoverid, noi

**Table A5**
use cs_alt_final.dta, replace
reg revolt dist_cluny latitude longitude sea river elevation ruggedness soilquality roman i.carolingian, r 
reg revoltsuc dist_cluny latitude longitude sea river elevation ruggedness soilquality roman i.carolingian, r 
reg revoltfai dist_cluny latitude longitude sea river elevation ruggedness soilquality roman i.carolingian, r 

**Table A6**
*Model 1*
use tscs_final.dta, replace
reg council c.dist_cluniac_x_post##bishop i.year post##bishop c.year##c.realm_parliament c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
*Model 2-3*
use cs_final.dta, replace
ivreg2 council_1000_1200 lpop capital  bishop pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian (dist_cluniac c.dist_cluniac#bishop =dist_cluny c.dist_cluny#bishop c.dist_cluny#c.dist_cluny c.dist_cluny#c.dist_cluny#bishop), r
ivreg2 council_1201_1800 lpop capital  bishop pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian (dist_cluniac c.dist_cluniac#bishop =dist_cluny c.dist_cluny#bishop c.dist_cluny#c.dist_cluny c.dist_cluny#c.dist_cluny#bishop), r
*Cross-sectional results without IV*
reg council_1000_1200 c.dist_cluniac##bishop lpop capital  pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian , r
reg council_1201_1800 c.dist_cluniac##bishop lpop capital  pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian , r

**Table A7**
*Model 1*
use tscs_final.dta, replace
reg council dist_cluniac_x_post i.year c.year##c.duni c.year##c.trade c.year##c.life c.year#c.viol c.year##c.area1000 c.year##c.area1300 c.year##c.area_change c.year##c.dfair c.year##bishop c.year##c.realm_parliament c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
*Model 2-3*
use cs_final.dta, replace
ivreg2 council_1000_1200 lifespan800_1300 violence800_1300 dfair area* trade pre_become lpop capital  bishop pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian (dist_cluniac  = c.dist_cluny), r
ivreg2 council_1201_1800 lifespan800_1300 violence800_1300 dfair area* trade pre_become lpop capital  bishop pre_nr pre_p roman c.latitude c.longitude sea  river c.soilquality c.elevation c.ruggedness  i.carolingian (dist_cluniac  = c.dist_cluny), r

**Bounding values for unbiased coefficients, footnote 83**
use tscs_final.dta, replace
qui reg council dist_cluniac_x_post  i.year, absorb(indicator) cluster(indicator)
matrix h1=e(b)
scalar a1=h1[1,1]
matrix il=e(r2)
scalar a2=il[1,1]
qui g j1=a1
qui g j2=a2
qui reg council dist_cluniac_x_post i.year c.year##c.realm_parliament c.year##bishop c.year##capital c.year##c.plundered c.year##c.lpop c.year##university , absorb(indicator) cluster(indicator)  
matrix h1=e(b)
scalar a3=h1[1,1]
matrix il=e(r2)
scalar a4=il[1,1]
qui g j3=a3
qui g j4=a4
qui g R_10=j3-1*((j1-j3)*(1-j4)/(j4-j2))
qui g R_9=j3-1*((j1-j3)*(0.9-j4)/(j4-j2))
di R_10 R_9

**Limiting the sample to AD 800-1200, footnote 86**
use tscs_final.dta, replace
reg council c.dist_cluniac_monastery##post if year<1300,  cluster(indicator) 
reg council dist_cluniac_x_post i.year if year<1300, absorb(indicator) cluster(indicator)   
reg council dist_cluniac_x_post i.year bishop capital plundered realm_parliament lpop university if year<1300, absorb(indicator) cluster(indicator)  
reg council dist_cluniac_x_post i.year c.year##bishop c.year##c.realm_parliament c.year##capital c.year##c.plundered c.year##c.lpop c.year##university if year<1300, absorb(indicator) cluster(indicator)  

**Sensitivity test for IV results, footnote 96**
use cs_final.dta, replace
qui plausexog uci council_1000_1800 latitude longitude sea river elevation ruggedness soilq i.carolingian roman (dist_cluniac=dist_cluny),  gmin(-1) gmax(-0.037) level(0.95) vce(robust)
matrix list e(b)
qui plausexog uci council_1000_1800 latitude longitude sea river elevation ruggedness soilq i.carolingian roman (dist_cluniac=dist_cluny),  gmin(-1) gmax(-0.038) level(0.95) vce(robust)
matrix list e(b)
//How large must gamma be before beta is equal to zero
di 0.038/0.0525
